<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>产品列表</title>
<!-- 用于转跳之后的路径恢复 -->
<%
	String path = request.getRequestURI();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<base href="<%=basePath%>"> 

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="style/adminStyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
 <div class="wrap">
  <div class="page-title">
    <span class="modular fl"><i class="add"></i><em>编辑/添加产品</em></span>
    <span class="modular fr"><a class="pt-link-btn" onclick="javascript:window.history.back();">产品列表</a></span>
  </div>
  <form action="../AddGoodsServlet?op=AddGood" method="post" enctype="multipart/form-data">
  <table class="list-style">
   <tr>
    <td style="text-align:right;width:15%;">产品名称：</td>
    <td><input type="text" class="textBox length-long" name="name"/></td>
   </tr>
   <tr>
    <td style="text-align:right;">产品分类：</td>
    <td>
     <select class="textBox" name="selectName">
      <option value="小米手机">小米手机</option>
      <option value="红米手机">红米手机</option>
     </select>
    </td>
   </tr>
   <tr>
    <td style="text-align:right;">标配价：</td>
    <td>
     <input type="text" class="textBox length-short" name="price" id="price" onInput ="keypress(this)"/>
     <span>元</span>
    </td>
   </tr>
   <tr>
    <td style="text-align:right;width:15%;">版本：</td>
    <td>
    <select class="textBox" name="edition">
    <option value="4GB+32GB">4GB+32GB</option>
    <option value="4GB+64GB">4GB+64GB</option>
     <option value="6GB+64GB">6GB+64GB</option>
      <option value="8GB+64GB">8GB+64GB</option>
      <option value="4GB+128GB">4GB+128GB</option>
      <option value="6GB+128GB">6GB+128GB</option>
      <option value="8GB+128GB">8GB+128GB</option>
      <option value="8GB+256GB">8GB+256GB</option>
     </select>
    </td>
   </tr>
   <tr>
    <td style="text-align:right;width:15%;">套餐：</td>
    <td>
        <select class="textBox" name="setmeal">
    <option value="标配">标配</option>
    <option value="+129元得洗手机">+129元得洗手机</option>
     <option value="+299得星芒钻幕壳">+299得星芒钻幕壳</option>
      <option value="+10元得18W快充">+10元得18W快充</option>
      <option value="+19元得果冻包">+19元得果冻包</option>
      <option value="+99得黑鲨手柄套餐">+99得黑鲨手柄套餐</option>
      <option value="27W 快充套装">27W 快充套装</option>
      <option value="大魔王套装">大魔王套装</option>
     </select>
    </td>
   </tr>
   
   <tr>
    <td style="text-align:right;">产品缩图片：</td>
    <td>
     <input type="file" id="suoluetu" class="hide" onchange="showImg(this)" name="img1"/>
     <label for="suoluetu" class="labelBtnAdd">+</label>
     <img src="" width="100px" height="100px" class="mlr5" id="imgaa"/>
    </td>
   </tr>
  
   <tr>
    <td style="text-align:right;width:15%;">颜色：</td>
    <td><input type="text" class="textBox length-long" name="color"/></td>
   </tr>
   <tr>
    <td style="text-align:right;">颜色图：</td>
    <td>
     <input type="file"  id="chanpinzhutu" class="hide" onchange="showImg2(this)" name="img2"/>
     <label for="chanpinzhutu" class="labelBtn2" >本地上传</label>
      <img src="#" width="100" height="100" id="imgb"/>
    </td>
   </tr>
   
   <tr>
    <td style="text-align:right;">产品详情：</td>
    <td><textarea class="textarea" name="details"></textarea></td>
   </tr>
   <tr>
    <td style="text-align:right;"></td>
    <td><input type="submit" value="发布新商品" class="tdBtn"/></td>
   </tr>
  </table>
  </form>
 </div>
<script type="text/javascript">
		$(function() {
			$(".tdBtn").click(function() {
				alert("发布新商品成功！");
			});
		});
	</script>
	<script type="text/javascript">
    function showImg(input) {
        var file = input.files[0];
        var reader = new FileReader()
        // 图片读取成功回调函数
        reader.onload = function(e) {
            document.getElementById('imgaa').src=e.target.result
        }
        reader.readAsDataURL(file)
    }

    function showImg2(input) {
        var file = input.files[0];
        var reader = new FileReader()
        // 图片读取成功回调函数
        reader.onload = function(e) {
            document.getElementById('imgb').src=e.target.result
        }
        reader.readAsDataURL(file)
    }

   
    function keypress(_this){
        _this.value = _this.value.replace(/[^0-9]/g, '');
    }

    
</script>

</body>
</html>